package com.jcli._socket基恩士客户端;

import javax.swing.JOptionPane;
import javax.swing.JFrame;

public class CloseFrame {
   public static void main(String[] args) {
      JFrame frame = new JFrame("Close Frame Example");
      int option = JOptionPane.showConfirmDialog(frame, "Do you want to close this frame?", "Close Frame", JOptionPane.YES_NO_OPTION);

      if (option == JOptionPane.YES_OPTION) {
         frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      } else {
         frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
      }

      frame.setSize(300, 200);
      frame.setVisible(true);
   }
}